﻿@model FilterTemplateIM
@{
    ViewBag.Title = "编辑" + EntityNames.FilterTemplate;
    ViewBag.PageTitle = ViewBag.Title + "_内容";
}


@section Header{

}


@using (Ajax.BeginForm("Edit", null, new AjaxOptions
{

    HttpMethod = "POST",
    OnBegin = "onBeginSave",
    OnComplete = "onCompleteSave",
    OnSuccess = "updateSuccess"

}, new { @class = "form-horizontal", role = "form" }))
{

    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.Id)


    <div class="panel panel-default">
        <header class="panel-heading">
            <span class="glyphicon glyphicon-edit"></span> @ViewBag.Title
        </header>

        <section class="panel-body">

            <div class="form-group">
                @Html.LabelFor(model => model.Name, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Name, new { @class = "form-control", placeholder = Labels.TemplateName })
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Source, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Source, new { @class = "form-control", placeholder = Labels.Source })
                    @Html.ValidationMessageFor(model => model.Source)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.KeywordSet, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextAreaFor(model => model.KeywordSet, new { @class = "form-control", placeholder = Labels.KeywordSet })
                    @Html.ValidationMessageFor(model => model.KeywordSet)
                    <p class="help-block">多个关键字用逗号隔开</p>
                </div>
                
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Encode, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Encode, new { @class = "form-control", placeholder = Labels.Encode })
                    @Html.ValidationMessageFor(model => model.Encode)
                    <p class="help-block">例：uft8，gb2312，GBK，为空不填为默认编码</p>
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Importance, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Importance, new { @class = "form-control", placeholder = Labels.Importance })
                    @Html.ValidationMessageFor(model => model.Importance)
                </div>

            </div>


            <div class="form-group">
                <div class="col-md-5 col-md-offset-2">
                    <div class="checkbox">
                        <label>
                            @Html.CheckBoxFor(model => model.Active)  @Html.DisplayNameFor(model => model.Active)
                        </label>
                    </div>
                </div>
                <div class="col-md-5">
                    @Html.ValidationMessageFor(model => model.Active)
                </div>
            </div>

            <h3>过滤设置</h3>
            <div class="form-group">
                @Html.LabelFor(model => model.LinksContainer, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.LinksContainer, new { @class = "form-control", placeholder = Labels.LinksContainer })
                    @Html.ValidationMessageFor(model => model.LinksContainer)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.Links, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Links, new { @class = "form-control", placeholder = Labels.LinksFilter })
                    @Html.ValidationMessageFor(model => model.Links)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.Title, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Title, new { @class = "form-control", placeholder = Labels.Title })
                    @Html.ValidationMessageFor(model => model.Title)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.Body, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Body, new { @class = "form-control", placeholder = Labels.Content })
                    @Html.ValidationMessageFor(model => model.Body)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Description, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Description, new { @class = "form-control", placeholder = Labels.Description })
                    @Html.ValidationMessageFor(model => model.Description)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.Keyword, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Keyword, new { @class = "form-control", placeholder = Labels.KeyWords })
                    @Html.ValidationMessageFor(model => model.Keyword)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.Author, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Author, new { @class = "form-control", placeholder = Labels.Author })
                    @Html.ValidationMessageFor(model => model.Author)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.PublishDate, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.PublishDate, new { @class = "form-control", placeholder = Labels.Pubdate })
                    @Html.ValidationMessageFor(model => model.PublishDate)
                </div>
            </div>


        </section>
        <footer class="panel-footer text-center">
            <button type="submit" class="btn btn-primary" id="btnSave"><i class="fa fa-save fa-fw"></i>  @Buttons.Update </button>
            <a href="@Url.Action("Index")" class="btn btn-default"><span class="glyphicon glyphicon-arrow-left"></span> @Buttons.Back</a>
        </footer>

    </div>
}


@Html.Action("PopuFinder", "File")

@section Footer {
    @Scripts.Render("~/bundles/jqueryvalWithBootstrap")

    <script src="~/plugins/tinymce/tinymce.min.js"></script>
    <script src="~/plugins/tinymce/langs/zh_CN.js"></script>

    <script>
      

        function onBeginSave() {
            $("#btnSave i").removeClass("fa-save").addClass("fa-spinner fa-spin");
        }
        function onCompleteSave() {
            $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-save");
        }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
        Common.ShowBox(data.Status, data.Message, title);
    }

       


        $(function () {
           
        })

    </script>
}




